import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
    {
        path: '/home',
        name: 'home',
        component: HomeView,
        meta: {
            requireAuth: true
        },
        children: [
            {
                path: '/user',
                name: 'user',
                component: () => import(/* webpackChunkName: "about" */ '../views/User/UserView.vue')
            },
            {
                path: '/department',
                name: 'department',
                component: () => import(/* webpackChunkName: "about" */ '../views/User/DepartmentView.vue')
            },
            {
                path: '/car',
                name: 'car',
                component: () => import(/* webpackChunkName: "about" */ '../views/Car/CarView.vue')
            }
            , {
                path: '/driver',
                name: 'driver',
                component: () => import(/* webpackChunkName: "about" */ '../views/Car/DriverView.vue')
            }, {
                path: '/carRequest',
                name: 'carRequest',
                component: () => import(/* webpackChunkName: "about" */ '../views/Car/CarRequestView.vue')
            }, {
                path: '/tripManage',
                name: 'tripManage',
                component: () => import(/* webpackChunkName: "about" */ '../views/Trip/TripManageView.vue')
            }, {
                path: '/historyCarRequest',
                name: 'historyCarRequest',
                component: () => import(/* webpackChunkName: "about" */ '../views/Car/HistoryCarRequestView.vue')
            }, {
                path: '/carRecord',
                name: 'carRecord',
                component: () => import(/* webpackChunkName: "about" */ '../views/Car/CarRecordView.vue')
            }, {
                path: '/tripReport',
                name: 'tripReport',
                component: () => import(/* webpackChunkName: "about" */ '../views/Trip/TripReportView.vue')
            }, {
                path: '/rating',
                name: 'rating',
                component: () => import(/* webpackChunkName: "about" */ '../views/Rating/RatingView.vue')
            }

        ]
    }, {
        path: '/',
        name: '登录',
        component: () => import('../views/Login/Login.vue'),
        meta: {requireAuth: false},
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
